import javax.microedition.lcdui.Graphics;


public class Mmenu extends Mscreen {

	public int index;
	public static int STATE_PLAY = 0;
	public static int STATE_HELP = 1;
	public static int STATE_OUT = 2;
	public static int STATE = STATE_PLAY;	
	
	
	public Mmenu()
	{
		index = 0;
	}
	
	public void update()
	{
		updateKey();
	}
	
	public void updateKey()
	{
		if(ExGameCanvas.keyPressed[4])
		{
			index--;
			if(index<=0)
			{
				index = 2;
			}
			
		}
		else if(ExGameCanvas.keyPressed[6])
		{
			index++;
			if(index >= 2)
			{
				index = 0;
			}
		}
		else if(ExGameCanvas.keyPressed[8])
		{
			switch (index) {
			case 0:
				ExGameCanvas.game_src.currentSreen();
				break;
			case 1:
				ExGameCanvas.help.currentSreen();
				break;
			case 2:
	
				break;

			default:
				break;
			}
		}
		
		ExGameCanvas.clear_keypressed();
	}
	
	
	public void paint(Graphics g)
	{
		g.setColor(0x000000);		
		g.fillRect(0, 0, widthScreen, heightScree);
		g.setColor(0xFFFFFF);
	
		switch (index) {
		
		case 0:
			g.drawString("Play", widthScreen/2, heightScree/2, 20);
			break;
		case 1:
			g.drawString("HELP", widthScreen/2, heightScree/2, 20);
			break;
		case 2:			
			g.drawString("OUT", widthScreen/2, heightScree/2, 20);
			break;

		default:
			break;
		}
		
	}
	
}
